#include <iostream>

using namespace std;

int func1() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long k;
    cin >> n >> k;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());

    vector<long long> prefix(n+1, 0);
    for (int i = 0; i < n; i++) prefix[i+1] = prefix[i] + a[i];

    int ans = 1;
    int l = 0;
    for (int r = 0; r < n; r++) {
        // 当前区间 [l..r] 变为 a[r] 的代价
        while (l <= r) {
            long long cost = a[r] * (r - l + 1LL) - (prefix[r+1] - prefix[l]);
            if (cost <= k) break;
            l++;
        }
        ans = max(ans, r - l + 1);
    }

    cout << ans << "\n";
    return 0;
}


int func2() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    if (!(cin >> T)) return 0;
    while (T--) {
        int n; cin >> n;
        // dp[player][pos]，pos 范围 1..10，这里开到 11 方便下标
        int dp[2][11] = {};
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            int p, s; cin >> p >> s; // p∈{0,1}, s∈[1..10]
            int best = 0;
            for (int t = 1; t <= 10; ++t) if (t != s) best = max(best, dp[p ^ 1][t]);
            dp[p][s] = max(dp[p][s], best + 1);
            ans = max(ans, dp[p][s]);
        }
        cout << ans << "\n";
    }
    return 0;
}


int func3() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while (T--) {
        int n;
        cin >> n;
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
        int ans = 1; // 至少能选第一个
        for (int i = 1; i < n; i++) {
            if (a[i] != a[i - 1]) ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}
